package com.lagou.config;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;

/**
 * @author 陶肖寅
 * @version V1.0
 * @Package com.lagou.config
 * @email fromlx@126.com
 * @date 2020-04-07 17:34
 * @Copyright © 2020-2021 城云科技(中国)有限公司
 */
public class ZKUtils {
    private static final String zkServerIps = "118.31.175.207:2181";

    public static synchronized CuratorFramework getClient() {
        CuratorFramework client = CuratorFrameworkFactory.builder().connectString(zkServerIps)
                .sessionTimeoutMs(6000).connectionTimeoutMs(3000) //.namespace("LeaderLatchTest")
                .retryPolicy(new ExponentialBackoffRetry(1000, 3)).build();
        return client;
    }
}
